<#assign ctx="${rc.contextPath}">
<html>
<head>
    <title>主题管理</title>
    <script type="text/javascript" src="${ctx}/static/js/ajaxupload.3.9.js"></script>
    <script type="text/javascript">
        //注意：若使用window.onload会导致sitemesh失效
        $(document).ready(function () {
            //初始化图片上传
            var btnImg = document.getElementById("btnUploadImg");
            var img = document.getElementById("imgShow");
            var hidImgName = document.getElementById("hidImgName");
            ajxUploadImg(btnImg, img);
        });

        var ajxTempDir = "${ctx}/static/images/";
        //图片上传
        function ajxUploadImg(btn, img) {
            var button = btn;
            new AjaxUpload(button, {
                action: '${ctx}/account/theme/upload',
                data: {},
                name: 'uploadFile',
                onSubmit: function (file, ext) {
                    //带参数
                    this.setData({});
                    if (!(ext && /^(jpg|JPG|png|PNG|gif|GIF)$/.test(ext))) {
                        alert("您上传的图片格式不对，请重新选择！");
                        return false;
                    }
                },
                onComplete: function (file, result) {
                    result = eval('(' + result + ')');
                    successMsg(result.message);
                    window.location.reload();
                    //parent.location.reload()刷新父亲对象（用于框架）--需在iframe框架内使用
                    // opener.location.reload()刷新父窗口对象（用于单开窗口
                    //top.location.reload()刷新最顶端对象（用于多开窗口）
                }
            });
        }

        function save() {
            if ($("#frmEdit").form('validate') && checkForm("frmEdit")) {
                var data = $("#frmEdit").serializeObject();
                $.ajax({
                    type: "POST",
                    url: $("#frmEdit").attr('action'),
                    data: data,
                    dataType: 'json',
                    success: function (result) {
                        successMsg(result.message);
                    }
                });
            }
        }

        function cancel() {
            window.location.href = "${ctx}/account/theme/page/";
        }
    </script>
</head>

<body>
<div class="breadcrumb"> 系统管理 > 主题管理</div>

<div class="toolbar">
    <input type="button" class="btn btn-primary" onclick="save()" value="保存">
    <input type="button" class="btn" onclick="cancel()" value="取消">
</div>

<form class="form-horizontal form-edit" action="${ctx}/account/theme/save" method="post" id="frmEdit">
    <fieldset class="dg-fieldset">
        <input type="hidden" id="accThemeId" name="accThemeId" value="${accTheme.accThemeId!}"/>
        <legend>主题信息</legend>
        <div class="form-item">
            <div class="form-lab">标题：<span class="must">*</span></div>
            <div class="form-field">
                <input class="easyui-validatebox text" name="accThemeTitle" id="accThemeTitle"
                       value="${accTheme.accThemeTitle!}" data-options="required:true" maxlength="10"/>
            </div>
        </div>
        <div class="form-item">
            <div class="form-lab">欢迎语：<span class="must">*</span></div>
            <div class="form-field">
                <input class="easyui-validatebox text" name="accThemeWelcome" id="accThemeWelcome"
                       value="${accTheme.accThemeWelcome!}" data-options="required:true" maxlength="20"/>
            </div>
        </div>
        <div class="form-item">
            <div class="form-lab">公司名称：<span class="must">*</span></div>
            <div class="form-field">
                <input class="easyui-validatebox text" name="accThemeCompanyName" id="accThemeCompanyName"
                       value="${accTheme.accThemeCompanyName!}" data-options="required:true" maxlength="20"/>
            </div>
        </div>
        <div class="form-item">
            <div class="form-lab">LOGO：<span class="must">*</span></div>
            <div class="form-field">
                <div class="uploadImg">
                    <img id="imgShow" src="${ctx}/static/images/logo.png"/>
                    <input style="margin-top: 5px" type="button" class="btn" id="btnUploadImg" value="上传"/>
                </div>
            </div>
        </div>
    </fieldset>
</form>

</body>
</html>
